package com.yjz.jvm.juc.线程.如何捕获线程里面的异常;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class MyTest {

    public static void main(String[] args) throws InterruptedException {

        Thread thread=new MyThread();
        thread.setUncaughtExceptionHandler((t,e)->{
            log.info("主线程捕获的线程里的异常"+e.getMessage());
        });

        thread.start();

        //强制排到主线程前面
        thread.join();


        log.info("主线程");
    }
}
